﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Web;
using FaceSharp.MVC.Code.Common;

namespace FaceSharp.MVC.Code.Extensions
{
    public static class StringEncryption
    {
        public static string MD5Encrypt(this string stringToEncrypt)
        {
            var keyToHash = stringToEncrypt;
            MD5 md5 = new MD5CryptoServiceProvider();
            var result = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(keyToHash));
            return result.ByteArrayToHexString();
        }
    }
}